<?php
/**
 * Created by PhpStorm.
 * User: landiyu
 * Date: 15-03-27
 * Time: 15:28
 */


namespace Home\Widget;
use Think\Action;

class LocationWidget extends Action {
    public function Location1(){

        //跳转到对应的模块
        $str = "SELECT cn_district FROM `sdg_location` WHERE cn_district<>'' AND location1='CN' GROUP by cn_district";
        //echo $str;
        $Model = M();
        $rs = $Model->query($str);
        //print_r($rs);

        $this->assign('Location1',$rs);// 赋值分页输出
        $this->display('Location/Location1');
    }

    public function Location2(){

        //跳转到对应的模块
        $str = "SELECT cn FROM `sdg_location` WHERE cn<>'' AND location1='CN' GROUP by cn";
        //echo $str;
        $Model = M();
        $rs = $Model->query($str);
        //print_r($rs);

        $this->assign('Location2',$rs);// 赋值分页输出
        $this->display('Location/Location2');
    }

    public function Location3(){

        //跳转到对应的模块
        $str = "SELECT cn_city FROM `sdg_location` WHERE cn_city<>'' AND location1='CN' GROUP by cn_city";
        //echo $str;
        $Model = M();
        $rs = $Model->query($str);
        //print_r($rs);

        $this->assign('Location3',$rs);// 赋值分页输出
        $this->display('Location/Location3');
    }


    public function Location(){

        //跳转到对应的模块
        $str = "SELECT cn_district,en_district FROM `sdg_location` WHERE cn_district<>'' AND location1='CN' GROUP by cn_district";
        $Model = M();
        $rs = $Model->query($str);
        $this->assign('Location1',$rs);// 赋值分页输出

        //跳转到对应的模块
        $str = "SELECT cn,location2 FROM `sdg_location` WHERE cn<>'' AND location1='CN' GROUP by cn";//echo $str;
        $Model = M();
        $rs = $Model->query($str);
        $this->assign('Location2',$rs);// 赋值分页输出

        //跳转到对应的模块
        $str = "SELECT cn_city,location3 FROM `sdg_location` WHERE cn_city<>'' AND location1='CN' GROUP by cn_city";
        $Model = M();
        $rs = $Model->query($str);
        $this->assign('Location3',$rs);// 赋值分页输出

        $this->display('Location/Location');
    }
}